package com.gadgets.framework.dict.service;

import com.gadgets.framework.common.dto.DictQueryDTO;
import com.gadgets.framework.common.dto.Pagination;
import com.gadgets.framework.common.pojo.Dict;
import com.gadgets.framework.common.repository.IDictRepository;
import com.gadgets.framework.common.util.PaginationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author xiujunqing
 * @version V1.0.1
 * @data 2021-09-22
 * @moduel com.gadgets.framework.dict.logic
 */
@Service
@Transactional(transactionManager = "gadgetsDbTransactionManage")
public class DictQueryServiceImpl implements IDictQueryService{

    @Autowired
    private IDictRepository dictRepository;

    @Override
    public List<Dict> pageQueryDictInfo(DictQueryDTO queryDTO, Pagination pagination) {
        PaginationUtil.bulidPaginationInfo(pagination);
        List<Dict> resultData = dictRepository.selectDictInfoByCondition(queryDTO);
        PaginationUtil.getPaginationResultInfo(resultData,pagination);
        return resultData;
    }

}
